import Vector2 from "./Vector2.js";
export default class Area {
    constructor(x = 0, y = 0, width = 0, height = 0) {
        this.width = 0;
        this.height = 0;
        this._x = 0;
        this._y = 0;
        this.width = width;
        this.height = height;
        this.position = new Vector2(x, y);
        this._x = x;
        this._y = y;
    }
    set x(val) {
        this._x = val;
        this.position.x = val;
    }
    get x() {
        return this._x;
    }
    get y() {
        return this._y;
    }
    set y(v) {
        this._y = v;
        this.position.y = v;
    }
    isOverLap(other) {
        if (Math.abs(this.x + this.width / 2 - (other.x + other.width / 2)) <
            Math.abs(this.width + other.width) / 2 &&
            Math.abs(this.y + this.height / 2 - (other.y + other.height / 2)) <
                Math.abs(this.height + other.height) / 2) {
            return true;
        }
        return false;
    }
}
